using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using static System.Net.Mime.MediaTypeNames;

namespace Cruel_WoW_Launcher
{
    /// <summary>
    /// Логика взаимодействия для Settings.xaml
    /// </summary>
    public partial class Settings : Window
    {
        public Settings()
        {
            InitializeComponent();
            LabelPuth.Content = Properties.Settings.Default.FilePutch;
        }

        private void Puth_Click(object sender, RoutedEventArgs e)
        {

                var dialog = new System.Windows.Forms.FolderBrowserDialog();
                System.Windows.Forms.DialogResult result = dialog.ShowDialog();

                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    string selectedPath = dialog.SelectedPath;
                    //Properties.Settings.Default.FilePutch = dialog.SelectedPath;
                    Properties.Settings.Default["FilePutch"] = dialog.SelectedPath;
                    Properties.Settings.Default.Save();
                    string wowExePath = System.IO.Path.Combine(selectedPath, "wow.exe");
                    Properties.Settings.Default.WoWExe = wowExePath;
                    Properties.Settings.Default.Save();
                LabelPuth.Content = Properties.Settings.Default.FilePutch;
            }

        }
    }
}
